# Maintainer : Laurent Carlier <lordheavym@gmail.com>
# Contributor: Christoph Zeiler <archNOSPAM_at_moonblade.dot.org>

pkgname=performous
pkgver=1.2.0
pkgrel=8
pkgdesc='A free game like "Singstar", "Rockband" or "Stepmania"'
arch=('loong64' 'x86_64')
url="https://performous.org/"
license=('GPL')
depends=(
  'aubio'
  'boost-libs'
  'cairo'
  'ffmpeg'
  'fontconfig'
  'gcc-libs'
  'glib2'
  'glibc'
  'glibmm'
  'icu'
  'libepoxy'
  'libjpeg-turbo'
  'libpng'
  'librsvg'
  'libxml++2.6'
  'opencv'
  'pango'
  'portaudio'
  'portmidi'
  'sdl2'
)
makedepends=(
  'cmake'
  'boost'
  'git'  # TODO: this is used to clone sources during build time and should be devendored!!!
  'glm'
  'help2man'
  'mesa'
)
optdepends=('performous-freesongs: free songs for performous')
source=($pkgname-$pkgver.tar.gz::https://github.com/performous/performous/archive/refs/tags/${pkgver}.tar.gz
        ffmpeg5.patch)
sha512sums=('a8fbbe3768f46915eacb65adcc1592295e4c6a84775ca55def01ebcff2218b1860daee0d4d5fcccc407d8df71da1ac25da667b47dd4a17239041a3d5fbfa1c56'
            '4affb318c7fd6ac65ea4facfb2c5270ed6ec1816de69f1e77204c036cfb1c8cd548bb3e2e28bcd6169d531183fc8799669a86de95f4325e0b58254e596a0d5dc')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../ffmpeg5.patch # Fix build with FFMpeg 5
}

build() {
  local cmake_options=(
    -B build
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_BUILD_TYPE=None
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
